export const navigateToReport = (selectValue, params) => {
  const {
    order = {},
    orderId = '',
    bidTypeItem = '',
    equipment = {},
    checkText = '',
    status = '',
    editStatus = false // 新增编辑状态参数，默认false
  } = params || {}

  const baseParams = {
    workOrderId: encodeURIComponent(orderId),
    operatorName: encodeURIComponent(order.operatorName || ''),
    address: encodeURIComponent(order.address || ''),
    acceptNumber: encodeURIComponent(order.acceptNumber || ''),
    editStatus: encodeURIComponent(editStatus) // 新增统一参数处理
  }

  const routeMap = {
    '1': {
      url: '/pages/work/create/secondReport',
      params: `operatorName=${baseParams.operatorName}&address=${baseParams.address}`
    },
    '2': {
      url: '/pages/work/create/newReport',
      params: `operatorName=${baseParams.operatorName}&address=${baseParams.address}`
    },
    '3': {
      url: '/pages/work/create/oneReport',
      params: '' // 新增空参数占位
    },
    '4': {
      url: '/pages/work/create/reviewCheck',
      params: `order=${encodeURIComponent(JSON.stringify({
        ...order,
        workOrderId: orderId,
        editStatus // 保持参数结构统一
      }))}&bindType=${bidTypeItem}`
    },
    '5': {
      url: '/pages/work/create/fiveReport',
      params: `equipment=${encodeURIComponent(JSON.stringify({
        ...equipment,
        editStatus // 新增设备编辑状态
      }))}`
    },
    // ...其他路由配置保持相同改造逻辑
  }

  if (!routeMap[selectValue]) {
    uni.showToast({ title: '请选择一个选项', icon: 'none' })
    return
  }

  const { url, params: routeParams } = routeMap[selectValue]
  const fullUrl = `${url}?${routeParams}${routeParams ? '&' : ''}${Object.entries(baseParams)
    .map(([k, v]) => `${k}=${v}`)
    .join('&')}` // 统一拼接基础参数
  
  uni.navigateTo({ url: fullUrl })
}